<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <link rel="stylesheet" type="text/css" media="screen" href="../../css/bootstrap.min.css">
</head>
<body>
<div class="col-xs-12 col-sm-12 col-md-12 col-lg-12">
    <form class="form-horizontal" onsubmit="return false" id="form">
        <fieldset>
            <input type="hidden" id="id" name="id">
            <div class='form-group'>
                <label class='col-md-2 control-label'>发布人id</label>
                <div class='col-md-10'>
                    <input class='form-control' type='text' name='userId' id='userId'>
                </div>
            </div>

            <div class='form-group'>
                <label class='col-md-2 control-label'>描述</label>
                <div class='col-md-10'>
                    <input class='form-control' type='text' name='describe' id='describe'>
                </div>
            </div>

            <div class='form-group'>
                <label class='col-md-2 control-label'>图片</label>
                <div class='col-md-10'>
                    <span id="imageUrl"></span>
                </div>
            </div>

            <div class='form-group'>
                <label class='col-md-2 control-label'>称呼</label>
                <div class='col-md-10'>
                    <input class='form-control' type='text' name='realname' id='realname'>
                </div>
            </div>
            <div class='form-group'>
                <label class='col-md-2 control-label'>联系方式</label>
                <div class='col-md-10'>
                    <input class='form-control' type='text' name='number' id='number'>
                </div>
            </div>
            <div class='form-group'>
                <label class='col-md-2 control-label'>订单id</label>
                <div class='col-md-10'>
                    <input class='form-control' type='text' name='payId' id='payId'>
                </div>
            </div>
            <div class='form-group'>
                <label class='col-md-2 control-label'>交易单号</label>
                <div class='col-md-10'>
                    <input class='form-control' type='text' name='payNumber' id='payNumber'>
                </div>
            </div>
            <div class='form-group'>
                <label class='col-md-2 control-label'>商户单号</label>
                <div class='col-md-10'>
                    <input class='form-control' type='text' name='payMerchantNumber'
                           id='payMerchantNumber'>
                </div>
            </div>
            <div class='form-group'>
                <label class='col-md-2 control-label'>接单律师id</label>
                <div class='col-md-10'>
                    <input class='form-control' type='text' name='serviceLawyerId'
                           id='serviceLawyerId'>
                </div>
            </div>
            <div class='form-group'>
                <label class='col-md-2 control-label'>支付状态</label>
                <div class='col-md-10'>
                    <input class='form-control' type='text' name='payState' id='payState'>
                </div>
            </div>
            <div class='form-group'>
                <label class='col-md-2 control-label'>订单状态</label>
                <div class='col-md-10'>
                    <input class='form-control' type='text' name='state' id='state'>
                </div>
            </div>

            <div class='form-group'>
                <label class='col-md-2 control-label'>寄送律件</label>
                <div class='col-md-10'>
                    <span id="file"></span>
                </div>
            </div>

            <div class='form-group'>
                <label class='col-md-2 control-label'>函件双方(我方)</label>
                <div class='col-md-10'>
                    <input class='form-control' type='text' name='we' id='we'>
                </div>
            </div>
            <div class='form-group'>
                <label class='col-md-2 control-label'>函件双方（对方）</label>
                <div class='col-md-10'>
                    <input class='form-control' type='text' name='otherParty' id='otherParty'>
                </div>
            </div>
            <div class='form-group'>
                <label class='col-md-2 control-label'>备注</label>
                <div class='col-md-10'>
                    <input class='form-control' type='text' name='content' id='content'>
                </div>
            </div>
            <div class='form-group'>
                <label class='col-md-2 control-label'>收件人</label>
                <div class='col-md-10'>
                    <input class='form-control' type='text' name='addRessee' id='addRessee'>
                </div>
            </div>
            <div class='form-group'>
                <label class='col-md-2 control-label'>收件人联系电话</label>
                <div class='col-md-10'>
                    <input class='form-control' type='text'
                           name='recipientPhoneNumber' id='recipientPhoneNumber'>
                </div>
            </div>
            <div class='form-group'>
                <label class='col-md-2 control-label'>收件地址</label>
                <div class='col-md-10'>
                    <input class='form-control' type='text' name='address' id='address'>
                </div>
            </div>

            <div class='form-group'>
                <label class='col-md-2 control-label'>快递单号</label>
                <div class='col-md-10'>
                    <input class='form-control' type='text' name='courierNumber'
                           id='courierNumber'>
                </div>
            </div>
            <div class='form-group'>
                <label class='col-md-2 control-label'>发件人姓名</label>
                <div class='col-md-10'>
                    <input class='form-control' type='text' name='Sender' id='Sender'>
                </div>
            </div>
            <div class='form-group'>
                <label class='col-md-2 control-label'>发件人地址</label>
                <div class='col-md-10'>
                    <input class='form-control' type='text' name='originatingPlace'
                           id='originatingPlace'>
                </div>
            </div>
            <div class='form-group'>
                <label class='col-md-2 control-label'>发件人电话</label>
                <div class='col-md-10'>
                    <input class='form-control' type='text' name='SenderPhone'
                           id='SenderPhone'>
                </div>
            </div>
            <div class='form-group'>
                <label class='col-md-2 control-label'>支付时间</label>
                <div class='col-md-10'>
                    <input class='form-control' type='text' name='paymentTime'
                           id='paymentTime'>
                </div>
            </div>
            <div class='form-group'>
                <label class='col-md-2 control-label'>金额</label>
                <div class='col-md-10'>
                    <input class='form-control' type='text' name='money' id='money'>
                </div>
            </div>

            <div class='form-group'>
                <label class='col-md-2 control-label'>自动确认收货时间</label>
                <div class='col-md-10'>
                    <input class='form-control' type='text' name='confirmTime'
                           id='confirmTime'>
                </div>
            </div>
            <div class='form-group'>
                <label class='col-md-2 control-label'>自动拒绝服务时间</label>
                <div class='col-md-10'>
                    <input class='form-control' type='text' name='refuseTime' id='refuseTime'>
                </div>
            </div>
            <div class='form-group'>
                <label class='col-md-2 control-label'>评论状态</label>
                <div class='col-md-10'>
                    <input class='form-control' type='text' name='commentState' id='commentState'>
                </div>
            </div>



            <div class="form-actions">
                <div class="row" align="center">
                    <div class="col-md-12">
                        <button class="btn btn-primary" onclick="location.href='mfflLawyerletterList.html'">返回</button>
                        <!--<button class="btn btn-primary" type="submit" onclick="update()">-->
                        <!--<i class="fa fa-save"></i> 保存-->
                        <!--</button>-->
                    </div>
                </div>
            </div>

        </fieldset>
    </form>
</div>
<script type="text/javascript" src="../../js/libs/jquery-2.1.1.min.js"></script>
<script type="text/javascript" src="../../js/jq.js"></script>
<script type="text/javascript" src="../../js/plugin/bootstrapvalidator/bootstrapValidator.min.js"></script>
<script type="text/javascript" src="../../js/common.js"></script>
<script type="text/javascript" src="../../layui/layui.js"></script>
<script type="text/javascript">
    layui.use(['layer', 'laydate'], function () {
        var layer = layui.layer;
    });

    $(document).ready(function () {
        $('input').attr('disabled', 'disabled');
    });

    function isEmpty(obj) {
        if (typeof obj == "undefined" || obj == null || obj == "") {
            return true;
        } else {
            return false;
        }
    }

    initData();

    function initData() {
        var id = getUrlParam("id");
        if (id != "") {
            $.ajax({
                type: 'get',
                url: '/mfflLawyerletters/' + id,
                async: false,
                success: function (data) {
                    console.log(data);
                    $('#id').val(data.id);
                    $('#describe').val(data.describe);
                    if (!isEmpty(data.imageUrl)) {
                        var imageUrlGroup = data.imageUrl.split(";");
                        var imageUrl = '';
                        for (var i = 0; i < imageUrlGroup.length; i++) {
                            imageUrl += '<a href="/statics' + imageUrlGroup[i] + '" target="_blank"><img src="/statics' + imageUrlGroup[i] + '"    height="120" width="120" ></a>&nbsp;&nbsp;&nbsp;&nbsp;';
                        }
                        $('#imageUrl').html(imageUrl);
                    }
                    $('#realname').val(data.realname);
                    $('#number').val(data.number);
                    $('#payId').val(data.payId == '0'?'':data.payId);
                    $('#payNumber').val(data.payNumber);
                    $('#payMerchantNumber').val(data.payMerchantNumber);
                    $('#serviceLawyerId').val(data.serviceLawyerId);


                    if (!isEmpty(data.file)) {
                        var fileGroup = data.file.split(";");
                        var file = '';
                        for (var i = 0; i < fileGroup.length; i++) {
                            file += '<a href="/statics' + fileGroup[i] + '" target="_blank"><img src="/statics' + fileGroup[i] + '"    height="120" width="120" ></a>&nbsp;&nbsp;&nbsp;&nbsp;';
                        }
                        $('#file').html(file);
                    }

                    var payState = data.payState;
                    if (payState == '0') {
                        payState = "待支付";
                    }
                    if (payState == '1') {
                        payState = "已支付";
                    }
                    if (payState == '2') {
                        payState = "已退款";
                    }
                    if (payState == '3') {
                        payState = "申请退款";
                    }
                    $('#payState').val(payState);

                    var state = data.state;
                    if (state == "0") {
                        state = "发布成功";
                    } else if (state == 1) {
                        state = "已接单";
                    } else if (state == 2) {
                        state = "拒绝接单";
                    } else if (state == 3) {
                        state = "已发送";
                    } else if (state == 4) {
                        state = "完成";
                    } else if (state == 5) {
                        state = "已撤销";
                    } else if (state == 6) {
                        state = "超时撤销";
                    } else if (state == 7) {
                        state = "已退款";
                    }

                    $('#state').val(state);
                    $('#we').val(data.we);
                    $('#otherParty').val(data.otherParty);
                    $('#content').val(data.content);
                    $('#addRessee').val(data.addRessee);
                    $('#recipientPhoneNumber').val(data.recipientPhoneNumber);
                    $('#address').val(data.address);
                    $('#courierCompany').val(data.courierCompany);
                    $('#courierNumber').val(data.courierNumber);
                    $('#Sender').val(data.Sender);
                    $('#originatingPlace').val(data.originatingPlace);
                    $('#SenderPhone').val(data.SenderPhone);
                    $('#paymentTime').val(data.paymentTime);
                    $('#money').val(data.money);
                    $('#userId').val(data.userId);
                    $('#confirmTime').val(data.confirmTime);
                    $('#refuseTime').val(data.refuseTime);
                    $('#commentState').val(data.commentState=='0'?'未评论':'已评论');
                }
            });
        }
    }

    // function update() {
    // 	$('#form').bootstrapValidator();
    // 	var bootstrapValidator = $("#form").data('bootstrapValidator');
    // 	bootstrapValidator.validate();
    // if(!bootstrapValidator.isValid()){
    // 	   return;
    // }
    //
    // var formdata = $("#form").serializeObject();
    //
    // 	$.ajax({
    // 		type : 'put',
    // 		url : '/mfflLawyerletters',
    // 		contentType: "application/json; charset=utf-8",
    // 		data : JSON.stringify(formdata),
    // 		success : function(data) {
    // 			layer.msg("修改成功", {shift: -1, time: 1000}, function(){
    //     location.href = "mfflLawyerletterList.html";
    //     });
    // 		}
    // 	});
    // }

</script>
</body>
</html>
